package com.ruoyi.webshop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.webshop.mapper.CategoryOneMapper;
import com.ruoyi.webshop.domain.CategoryOne;
import com.ruoyi.webshop.service.ICategoryOneService;

/**
 * 一级分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-14
 */
@Service
public class CategoryOneServiceImpl implements ICategoryOneService 
{
    @Autowired
    private CategoryOneMapper categoryOneMapper;

    /**
     * 查询一级分类
     * 
     * @param coneId 一级分类主键
     * @return 一级分类
     */
    @Override
    public CategoryOne selectCategoryOneByConeId(Long coneId)
    {
        return categoryOneMapper.selectCategoryOneByConeId(coneId);
    }

    /**
     * 查询一级分类列表
     * 
     * @param categoryOne 一级分类
     * @return 一级分类
     */
    @Override
    public List<CategoryOne> selectCategoryOneList(CategoryOne categoryOne)
    {
        return categoryOneMapper.selectCategoryOneList(categoryOne);
    }

    /**
     * 新增一级分类
     * 
     * @param categoryOne 一级分类
     * @return 结果
     */
    @Override
    public int insertCategoryOne(CategoryOne categoryOne)
    {
        categoryOne.setCreateTime(DateUtils.getNowDate());
        return categoryOneMapper.insertCategoryOne(categoryOne);
    }

    /**
     * 修改一级分类
     * 
     * @param categoryOne 一级分类
     * @return 结果
     */
    @Override
    public int updateCategoryOne(CategoryOne categoryOne)
    {
        categoryOne.setUpdateTime(DateUtils.getNowDate());
        return categoryOneMapper.updateCategoryOne(categoryOne);
    }

    /**
     * 批量删除一级分类
     * 
     * @param coneIds 需要删除的一级分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryOneByConeIds(Long[] coneIds)
    {
        return categoryOneMapper.deleteCategoryOneByConeIds(coneIds);
    }

    /**
     * 删除一级分类信息
     * 
     * @param coneId 一级分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryOneByConeId(Long coneId)
    {
        return categoryOneMapper.deleteCategoryOneByConeId(coneId);
    }

    @Override
    public List<CategoryOne> selectCategoryOneListAll() {
        return categoryOneMapper.selectCategoryOneListAll();
    }
}
